<?php
	include "../../public/commom/config.php";
	include "../lock1.php";	
?>

<!DOCTYPE html>
<html>
	
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.1.0/css/bootstrap.min.css">
		<link rel="stylesheet" type="text/css" href="../public/css/index.css"/>
	</head>
	
	<body>
		<div class="container">
			<h1>添加商品</h1>
			<form action="addshop1.php" method="post" enctype="multipart/form-data">
				<div class="form-group">
					<label>
						名称：
						<input type="text" class="form-control" name="name" placeholder="请输入名称.." autocomplete="off" />
					</label>
				</div>
				<div class="form-group">
					<label>
						价格：
						<input type="text" class="form-control" name="pice" placeholder="请输入价格.." autocomplete="off" />
					</label>
				</div>
				<div class="form-group">
					<label>
						库存：
						<input type="text" class="form-control" name="inventory" placeholder="请输入库存.." autocomplete="off" />
					</label>
				</div>
				<div class="form-group">
					<label>
						商品品牌：
						<select class="form-control" name="brand_id">
							<?php
								$csql = "SELECT * FROM class";
							
								$cresult = mysqli_query($conn, $csql);
								
								while($row = mysqli_fetch_array($cresult)) {
									echo "<option disabled>" . $row["name"] . "</option>";
									
									$bsql = "SELECT * FROM brand WHERE " . $row['id'] . " = class_id";
									
									$bresult = mysqli_query($conn, $bsql);
									
									while($row = mysqli_fetch_array($bresult)) {
										echo "<option value=" . $row["id"] . ">" . $row["name"] . "</option>";
									}
									
								}
								
								mysqli_close($conn);
							?>
						</select>
					</label>
				</div>
				商品状态：
				<div class="radio">
					<label>
						<input type="radio" name="sheif" value="0" checked>上架
					</label>
				</div>
				<div class="radio">
					<label><input type="radio" name="sheif" value="1">下架</label>
				</div>
				<div class="form-group">
					<label>
						上传图片：
						<input type="file" name="img" accept="image/gif, image/jpeg, image/png, image/jpg, image/webp">		
					</label>
				</div>
				<input type="submit" class="btn btn-primary" value="添加"/>
			</form>
		</div>
	</body>
	
</html>